<%--
  Created by IntelliJ IDEA.
  User: user
  Date: 2021/5/13
  Time: 16:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    //获取项目的根路径
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>

    <title>修改密码</title>
    <script src="../layui-v2.6.6/layui/layui.js"></script>
    <link rel="stylesheet" href="../layui-v2.6.6/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>sweetalert.css">
    <script type="text/javascript" src="<%=basePath%>sweetalert-dev.js"></script>
    <style type="text/css">
        #kuang1{
            width: 450px;
            height: 380px;
            border: 0px #ffffff solid;
            margin:auto;
            text-align:center;
            margin-top: -50px;
            background-color: rgba(17, 16, 16, 0.5);

        }
        #biao{
            width: 330px;
            height: 200px;
            background-color: #FFFFFF;
            margin:auto;
            border-radius:20px 20px 20px 20px;
            background-color: rgba(246, 244, 244, 0.4);
            padding-top: 56px;
            padding-right: 26px;
        }
        *{
            margin: 0px;
        }
        #zhaohui{
            margin-top: 100px;
            margin-bottom: 30px;
            padding-top: 15px;
            color: #FFFFFF;
        }


       input[type="password"]{
            width: 200px;
            padding: 16px 10px 15px 60px;
            font-size: 14px;
            background: transparent;
            border: none;
            border: 2px solid #ffffff;
            outline: none;
            margin-bottom: 26px;
            color: #fff;
            border-radius:25px;
        }
        ::-webkit-input-placeholder{
            color: #F0F0F0;
            font-size: 14px;
            line-height: 50px;
        }
        .anniu{
            padding-top: 120px;
            /*width: 100px;*/
        }
    form p{
        font-size: 20px;
    }
       #biao input[type="button"]{
           background: orange;
           width: 180px;
           height: 30px;
           color: white;
           border-radius:20px 20px 20px 20px;
       }
    </style>
</head>
<body background="../cxq/img/fjsa.jpg" style=" background-repeat:no-repeat ;background-size:100% 100%;
background-attachment: fixed;">

<div id="kuang1">
    <h1 id="zhaohui">修改密码</h1>
    <div id="biao">
        <form action="#" method="post">
            <p>新 密 码 : <input type="Password" name="Password1" placeholder="请输入新密码" id="pwd1"  required></p>
            <p> 确认密码:<input type="Password" name="Password2" placeholder="请确认新密码" id="pwd2" required></p>
            <p><a href="javascript:void(1)" id="updpwd"><input type="button" value="确定修改"></a></p>
        </form>
    </div>
</div>
</body>
<script type="text/javascript" src="<%=basePath%>/jquery-1.12.4.js"></script>
<script type="text/javascript">
    $(function () {
        $("#pwd2").blur(function () {
            let pwd1=$("#pwd1").val();
            let pwd2 = $("#pwd2").val();
            if(pwd1==pwd2){

            }else {
                swal("两次密码不一样");
            }

    })
        $("#updpwd").click(function () {
            let pwds = $("#pwd2").val();
            alert(pwds);
            $.ajax(
                {
                    url:"<%=basePath%>ReaderLogin",
                    data:{
                        pwd:pwds,
                        id:${id},
                        tp:"updatePwd"
                    },
                    type:"post",
                    dataType:"json",
                    success:function (data) {
                        swal("修改成功！");
                    location.reload();
                    }
                });
        })
        $(".anniuzi").click(function () {
            let val1 = $("#input").val();
            let val2 = $("#input1").val();
            let val3 = $("#input2").val();

            if (val1.toString().trim().length == 0) {
                swal({
                    title: "新密码不能为空"
                })
            } else if (val2.toString().trim().length == 0) {
                swal({
                    title: "新密码不能为空"
                })
            } else if (val3.toString().trim().length == 0) {
                swal({
                    title: "新密码不能为空"
                })
            } else if (val2 != val3) {
                swal({
                    title: "两次密码输入不一致"
                })
                return;
            }
        })
    });
</script>
</html>
